package edu.bath.sensorframework.triplestore.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class AddDataSource extends DialogBox {
	
	public AddDataSource() {
		HTML space = new HTML("&#160;");
		setText("Add a data source");
//		setAnimationEnabled(true);
		setGlassEnabled(true);

		VerticalPanel contentPanel = new VerticalPanel();
		setWidget(contentPanel);

		contentPanel.setWidth("640px");
		contentPanel.setHeight("480px");
		
		// Content
		FlexTable dataSourceTable = new FlexTable();
		dataSourceTable.setWidth("100%");
		dataSourceTable.setWidget(0, 0, new HTML("<b>Name</b>"));
		dataSourceTable.setWidget(0, 1, new HTML("<b>Handle</b>"));
		dataSourceTable.setWidget(0, 2, new Label(""));
		
		ScrollPanel scrollable = new ScrollPanel(dataSourceTable);
		contentPanel.add(scrollable);
		
		// Bottom buttons
		HorizontalPanel buttonsPanel = new HorizontalPanel();
		Button addButton = new Button("Add");
		addButton.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
			}
		});
		buttonsPanel.add(addButton);
		buttonsPanel.add(space);
		
		Button closeButton = new Button("Cancel");
		closeButton.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				AddDataSource.this.hide();
			}
		});
		buttonsPanel.add(closeButton);
		
		contentPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
		contentPanel.add(buttonsPanel);
	}
}
